package tour.spring.bc.jms.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

import tour.spring.bc.assembler.TourAssembler;
import tour.spring.bc.dto.TourDto;
import tour.spring.bc.jms.JmsSender;

@Component
public class JmsSenderImpl implements JmsSender{

	@Autowired
	private TourAssembler tourAssembler;
	@Autowired
    private JmsTemplate jmsTemplate;
	
	 public void send(String destinationName, Object msg) {
		 jmsTemplate.convertAndSend(destinationName, msg);
	 }
	 
	 public void sendTour(TourDto tour) {
		 jmsTemplate.convertAndSend("tours.queue", tour);
	 }

	public JmsTemplate getJmsTemplate() {
		return jmsTemplate;
	}

	public void setJmsTemplate(JmsTemplate jmsTemplate) {
		this.jmsTemplate = jmsTemplate;
	}

	public TourAssembler getTourAssembler() {
		return tourAssembler;
	}

	public void setTourAssembler(TourAssembler tourAssembler) {
		this.tourAssembler = tourAssembler;
	}
	 
	 
}
